<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>fdk-aac: original/libFDK/src/qmf.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">fdk-aac
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_ed137715e08969a186ec660e8ae6e2fb.html">original</a></li><li class="navelem"><a class="el" href="dir_28764f9257266d97c7295693d7c6996f.html">libFDK</a></li><li class="navelem"><a class="el" href="dir_25dde5328027b7c94f7c7b75e3f8d6f2.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">qmf.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Complex qmf analysis/synthesis This module contains the qmf filterbank for analysis [ cplxAnalysisQmfFiltering() ] and synthesis [ cplxSynthesisQmfFiltering() ]. It is a polyphase implementation of a complex exponential modulated filter bank. The analysis part usually runs at half the sample rate than the synthesis part. (So called "dual-rate" mode.)  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="qmf_8h_source.html">qmf.h</a>&quot;</code><br />
<code>#include &quot;FDK_trigFcts.h&quot;</code><br />
<code>#include &quot;fixpoint_math.h&quot;</code><br />
<code>#include &quot;dct.h&quot;</code><br />
<code>#include &quot;qmf_pcm.h&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:afd3bf39a71db27c5cbdae3f8f02db077"><td class="memItemLeft" align="right" valign="top"><a id="afd3bf39a71db27c5cbdae3f8f02db077"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>QSSCALE</b>&#160;&#160;&#160;(0)</td></tr>
<tr class="separator:afd3bf39a71db27c5cbdae3f8f02db077"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a471c50b9d7a8eb648447adf9ab3a819c"><td class="memItemLeft" align="right" valign="top"><a id="a471c50b9d7a8eb648447adf9ab3a819c"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>FX_DBL2FX_QSS</b>(x)&#160;&#160;&#160;(x)</td></tr>
<tr class="separator:a471c50b9d7a8eb648447adf9ab3a819c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd9631e0d8816bc587b7f8383eb71247"><td class="memItemLeft" align="right" valign="top"><a id="abd9631e0d8816bc587b7f8383eb71247"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>FX_QSS2FX_DBL</b>(x)&#160;&#160;&#160;(x)</td></tr>
<tr class="separator:abd9631e0d8816bc587b7f8383eb71247"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56456f7594a800dfa9d5b103f5003c85"><td class="memItemLeft" align="right" valign="top"><a id="a56456f7594a800dfa9d5b103f5003c85"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>INT_PCM_QMFOUT</b>&#160;&#160;&#160;<a class="el" href="machine__type_8h.html#ac024ad9a1e48a3e87d360d519d943512">INT_PCM</a></td></tr>
<tr class="separator:a56456f7594a800dfa9d5b103f5003c85"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a956df02b72cc9c4b021405432e1282e0"><td class="memItemLeft" align="right" valign="top"><a id="a956df02b72cc9c4b021405432e1282e0"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>SAMPLE_BITS_QMFOUT</b>&#160;&#160;&#160;SAMPLE_BITS</td></tr>
<tr class="separator:a956df02b72cc9c4b021405432e1282e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:afbf62e34fe9c67ebe0b5efb56e312110"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qmf_8cpp.html#afbf62e34fe9c67ebe0b5efb56e312110">qmfInitSynthesisFilterBank</a> (<a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a> h_Qmf, FIXP_QSS *pFilterStates, int noCols, int lsb, int usb, int no_channels, int flags)</td></tr>
<tr class="memdesc:afbf62e34fe9c67ebe0b5efb56e312110"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create QMF filter bank instance.  <a href="qmf_8cpp.html#afbf62e34fe9c67ebe0b5efb56e312110">More...</a><br /></td></tr>
<tr class="separator:afbf62e34fe9c67ebe0b5efb56e312110"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5bef0d7634451ad6d4ae534c91f2d37"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qmf_8cpp.html#ae5bef0d7634451ad6d4ae534c91f2d37">qmfChangeOutScalefactor</a> (<a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a> synQmf, int outScalefactor)</td></tr>
<tr class="memdesc:ae5bef0d7634451ad6d4ae534c91f2d37"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change scale factor for output data and adjust qmf filter states.  <a href="qmf_8cpp.html#ae5bef0d7634451ad6d4ae534c91f2d37">More...</a><br /></td></tr>
<tr class="separator:ae5bef0d7634451ad6d4ae534c91f2d37"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d9c3e55c050c9aeecf63f45666d7fe0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qmf_8cpp.html#a3d9c3e55c050c9aeecf63f45666d7fe0">qmfGetOutScalefactor</a> (<a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a> synQmf)</td></tr>
<tr class="memdesc:a3d9c3e55c050c9aeecf63f45666d7fe0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get scale factor change which was set by <a class="el" href="qmf_8cpp.html#ae5bef0d7634451ad6d4ae534c91f2d37" title="Change scale factor for output data and adjust qmf filter states.">qmfChangeOutScalefactor()</a>  <a href="qmf_8cpp.html#a3d9c3e55c050c9aeecf63f45666d7fe0">More...</a><br /></td></tr>
<tr class="separator:a3d9c3e55c050c9aeecf63f45666d7fe0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb1256d28e1dce82ccdf06eb7e0d55d2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="qmf_8cpp.html#acb1256d28e1dce82ccdf06eb7e0d55d2">qmfChangeOutGain</a> (<a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a> synQmf, FIXP_DBL outputGain, int outputGainScale)</td></tr>
<tr class="memdesc:acb1256d28e1dce82ccdf06eb7e0d55d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change gain for output data.  <a href="qmf_8cpp.html#acb1256d28e1dce82ccdf06eb7e0d55d2">More...</a><br /></td></tr>
<tr class="separator:acb1256d28e1dce82ccdf06eb7e0d55d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Complex qmf analysis/synthesis This module contains the qmf filterbank for analysis [ cplxAnalysisQmfFiltering() ] and synthesis [ cplxSynthesisQmfFiltering() ]. It is a polyphase implementation of a complex exponential modulated filter bank. The analysis part usually runs at half the sample rate than the synthesis part. (So called "dual-rate" mode.) </p>
<p>The coefficients of the prototype filter are specified in #qmf_pfilt640 (in <a class="el" href="sbr__rom_8cpp.html" title="Definition of constant tables.">sbr_rom.cpp</a>). Thus only a 64 channel version (32 on the analysis side) with a 640 tap prototype filter are used.</p>
<p><a class="anchor" id="PolyphaseFiltering"></a></p><h2>About polyphase filtering</h2>
<p>The polyphase implementation of a filterbank requires filtering at the input and output. This is implemented as part of cplxAnalysisQmfFiltering() and cplxSynthesisQmfFiltering(). The implementation requires the filter coefficients in a specific structure as described in #sbr_qmf_64_640_qmf (in <a class="el" href="sbr__rom_8cpp.html" title="Definition of constant tables.">sbr_rom.cpp</a>).</p>
<p>This module comprises the computationally most expensive functions of the SBR decoder. The accuracy of computations is also important and has a direct impact on the overall sound quality. Therefore a special test program is available which can be used to only test the filterbank: main_audio.cpp</p>
<p>This modules also uses scaling of data to provide better SNR on fixed-point processors. See <a class="el" href="struct_q_m_f___s_c_a_l_e___f_a_c_t_o_r.html">QMF_SCALE_FACTOR</a> (in sbr_scale.h) for details. An interesting note: The function getScalefactor() can constitute a significant amount of computational complexity - very much depending on the bitrate. Since it is a rather small function, effective assembler optimization might be possible. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="acb1256d28e1dce82ccdf06eb7e0d55d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acb1256d28e1dce82ccdf06eb7e0d55d2">&#9670;&nbsp;</a></span>qmfChangeOutGain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void qmfChangeOutGain </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a>&#160;</td>
          <td class="paramname"><em>synQmf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FIXP_DBL&#160;</td>
          <td class="paramname"><em>outputGain</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>outputGainScale</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Change gain for output data. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">synQmf</td><td>Handle of Qmf Synthesis Bank </td></tr>
    <tr><td class="paramname">outputGain</td><td>New gain for output data (mantissa) </td></tr>
    <tr><td class="paramname">outputGainScale</td><td>New gain for output data (exponent) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae5bef0d7634451ad6d4ae534c91f2d37"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae5bef0d7634451ad6d4ae534c91f2d37">&#9670;&nbsp;</a></span>qmfChangeOutScalefactor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void qmfChangeOutScalefactor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a>&#160;</td>
          <td class="paramname"><em>synQmf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>outScalefactor</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Change scale factor for output data and adjust qmf filter states. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">synQmf</td><td>Handle of Qmf Synthesis Bank </td></tr>
    <tr><td class="paramname">outScalefactor</td><td>New scaling factor for output data </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3d9c3e55c050c9aeecf63f45666d7fe0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d9c3e55c050c9aeecf63f45666d7fe0">&#9670;&nbsp;</a></span>qmfGetOutScalefactor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int qmfGetOutScalefactor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a>&#160;</td>
          <td class="paramname"><em>synQmf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get scale factor change which was set by <a class="el" href="qmf_8cpp.html#ae5bef0d7634451ad6d4ae534c91f2d37" title="Change scale factor for output data and adjust qmf filter states.">qmfChangeOutScalefactor()</a> </p>
<dl class="section return"><dt>Returns</dt><dd>scaleFactor </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">synQmf</td><td>Handle of Qmf Synthesis Bank </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="afbf62e34fe9c67ebe0b5efb56e312110"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afbf62e34fe9c67ebe0b5efb56e312110">&#9670;&nbsp;</a></span>qmfInitSynthesisFilterBank()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int qmfInitSynthesisFilterBank </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_q_m_f___f_i_l_t_e_r___b_a_n_k.html">HANDLE_QMF_FILTER_BANK</a>&#160;</td>
          <td class="paramname"><em>h_Qmf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FIXP_QSS *&#160;</td>
          <td class="paramname"><em>pFilterStates</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>noCols</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>lsb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>usb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>no_channels</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>flags</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create QMF filter bank instance. </p>
<dl class="section return"><dt>Returns</dt><dd>0 if succesful </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h_Qmf</td><td>Returns handle </td></tr>
    <tr><td class="paramname">pFilterStates</td><td>Handle to filter states </td></tr>
    <tr><td class="paramname">noCols</td><td>Number of timeslots per frame </td></tr>
    <tr><td class="paramname">lsb</td><td>lower end of QMF </td></tr>
    <tr><td class="paramname">usb</td><td>upper end of QMF </td></tr>
    <tr><td class="paramname">no_channels</td><td>Number of channels (bands) </td></tr>
    <tr><td class="paramname">flags</td><td>Low Power flag </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
